with c_pila;

generic

  max: integer:= 256;

package c_arbre is
  --type node is private;	
--  type arbre is private;
  --type arbre;
  type index is new integer range 0..max;
  type arbre is record
    i: index;
    val: character; 
    fe: index;
    fd: index;
    s: index;
  end record;
package it_pila is new c_pila(character);
use it_pila;
  type mem is array (index'range) of arbre;

  m: mem;
  dm: mem;
  lliure: index;
  e_stack: pila;

  procedure abuit(p: out arbre);
  procedure posa(r: in out arbre; e: in character);
--  procedure posa_fe(r: in out arbre; e: in character);
--  procedure posa_fd(r: in out arbre; e: in character);
  function consulta(i: in index) return character;
  function fe(r: in arbre) return index;
  function fd(r: in arbre) return index;
  procedure get_inordre(r: in out arbre; p: in out pila); 
  procedure sig_inordre(p: in out pila; i: out character); 

  procedure print_index(p: in index);
  procedure print(p: in arbre);
procedure list_all;

  procedure posa_op(p: in arbre; ne: character);
  procedure posa_elem(p: in arbre; ne: character);
  function empelta(op: in character; fe: in arbre; fd: in arbre) return arbre;

--private
--  type arbre is new integer range 0..max;
--  type node is record
--    valor: float:= 0.0;
--    operant: character:= ' ';
--    fe: index;
--    fd: index;
--  end record;
--  type mem is array (index'range) of node;
--

end c_arbre;
